package mt.service.impl;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import mt.entity.Product;
import mt.mapper.ProductMapper;
import mt.service.ProductService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

@Service
@RequiredArgsConstructor
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {


    @Override
    public List<Product> listByName(String name) {
        return baseMapper.selectList(Wrappers.lambdaQuery(Product.class).like(StringUtils.hasLength(name),Product::getName, name));
    }
}
